<%@page import="model.Role"%>
<%@page import="model.Staff"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<%
    Staff staff = (Staff) session.getAttribute("staff");

    if (staff == null) {
        response.sendRedirect(request.getContextPath() + "/Administration");
    } else if (!staff.getRoleList().contains(new Role(3))) {
        response.sendRedirect(request.getContextPath() + "/Administration/home");
    } else {
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Add Staff</title>
         <link href="<%= request.getContextPath()%>/css/style_for_page.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/style_for_menu.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/style_addtion.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/style_for_warehousing.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/adMenu.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/tHeaderFooter.css" rel="stylesheet" type="text/css"/>
    </head>
    <body class="container">
        <header>
            <div class="header"> 
                <%@include file="/include/mHeader.jsp" %>
            </div>
            <div class="adContent">
                <div class="adMenu">
                    <%@include file="/include/mMenu.jsp" %>
                </div>
            </div>
        </header>
                
                <div class="divcontent">
                    <s:form action="addstaff" namespace="/Administration/Staff" theme="simple">
                    <div class="content2">
                        <div class="registerbg" >
                            <div class="registerForm">
                                <h1>New Staff</h1>
                                <p style="text-align: left;">First Name: <s:textfield name="firstname" label="First Name" size="30" cssStyle="margin:auto;"/></p>
                                <p style="text-align: left;">Last Name:  <s:textfield name="lastname" label="Last Name" size="30" cssStyle="margin-right: 60px;"/></p>
                                <p style="text-align: left;">Address:    <s:textfield name="address" label="Address" size="30" cssStyle="margin-right: 60px;"/></p>
                                <p style="text-align: left;">Email:      <s:textfield name="email" label="Email" size="30" cssStyle="margin-right:60px;"/></p>
                                <p style="text-align: left;">Login Name: <s:textfield name="loginName" label="Login Name" size="30" cssStyle="margin-right:60px;"/></p>
                                <p style="text-align: left;">Password:   <s:password name="password" label="Password" size="30" cssStyle="margin-right:60px;"/></p>
                                <p style="text-align: left;">Birth Date: <s:textfield name="dob" label="Birth Date" size="30" cssStyle="margin:auto;"/></p>                   
                            </div>
                            <div class="registerTerms">
                                <h1>Add Staff Notes</h1>
                                </br>
                                <p>- <b>All fields are required.</b></p>
                                <p>- Phone should contain <b>only 10 digits.</b></p>
                                <p>- Birth Date should be in <b>mm/dd/yyyy</b> format (e.g. 02/28/2000).</p>
                                <p>- Login name must be from <b>6 to 30</b> characters.</p>
                                <p>- Password must be from <b>6 to 30</b> characters.</p>
                                <p>- You only choose <b>one role</b> in the check box below</p>
                                <br>   
                            </div>
                        </div> 
                        <div class="registerbg" >
                            <div class="registerFormVertical">
                                <div class="simpletable">
                                    <table  id="simpletable">
                                        <thead >
                                            <tr>
                                                <th style="width: 10%;"></th>
                                                <th style="width: 5%;">Manage Category</th> 
                                                <th style="width: 5%;">Manage Product </th>
                                                <th style="width: 5%;">Manage Staff</th>
                                                <th style="width: 5%;">Manage Customer</th>
                                                <th style="width: 5%;">Manage Supplier</th>
                                                <th style="width: 5%;">Manage Receipting</th>
                                                <th style="width: 5%;">Manage Issuing</th>
                                                <th style="width: 5%;">Inventory</th>
                                                <th style="width: 5%;">Use Bidding Algorithm</th>
                                                <th style="width: 5%;">Request  Receipt</th> 
                                                <th style="width: 5%;">Report</th>
                                                <th style="width: 5%;">Accept Receipt Request</th>
                                                <th style="width: 5%;">Check box</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td >Administrator</td>
                                                <% for(int i = 0; i<11; i++) {%>
                                                <td style="width: 5%;height:20px;"> <img src="<%= request.getContextPath()%>/css/dot2.png" alt="role" width="20" height="auto" title="role"/>
                                                </td>
                                                <% } %>
                                                <td></td>
                                                <td style="width: 5%;"> <s:checkbox name="administrator" fieldValue="true" theme="simple" value="false"/> </td>
                                            </tr>
                                            <tr>
                                                <td>Staff</td>
                                                <%for (int i = 0; i < 2; i++) {%>
                                                <td style="width: 5%;"> <img src="<%= request.getContextPath()%>/css/dot2.png" alt="role" width="20" height="auto" title="role"/>
                                                </td>
                                                    <% }%>
                                                    <td></td>
                                                <%for (int i = 0; i < 2; i++) {%>
                                                <td style="width: 5%;"> <img src="<%= request.getContextPath()%>/css/dot2.png" alt="role" width="20" height="auto" title="role"/>
                                                </td>
                                                    <% }%>    
                                                <%for (int i = 0; i < 4; i++) {%>
                                                <td></td>
                                                <% }%>
                                                <td style="width: 5%;"> <img src="<%= request.getContextPath()%>/css/dot2.png" alt="role" width="20" height="auto" title="role"/>
                                                </td>
                                                <td></td>
                                                <td></td>
                                                <td style="width: 5%;"> <s:checkbox name="newStaff" fieldValue="true" theme="simple" value="true"/> </td>
                                                
                                            </tr>
                                            <tr>
                                                <td >Store keeper</td>
                                                 <%for (int i = 0; i < 5; i++) {%>
                                                <td></td>
                                                <% }%>
                                                <%for (int i = 0; i < 3; i++) {%>
                                                <td style="width: 5%;"> <img src="<%= request.getContextPath()%>/css/dot2.png" alt="role" width="20" height="auto" title="role"/>
                                                </td>
                                                 <% }%>
                                                <td></td>
                                                 <td style="width: 5%;"> <img src="<%= request.getContextPath()%>/css/dot2.png" alt="role" width="20" height="auto" title="role"/>
                                                </td>
                                                <td style="width: 5%;"> <img src="<%= request.getContextPath()%>/css/dot2.png" alt="role" width="20" height="auto" title="role"/>
                                                </td>   
                                                <td></td>
                                                <td style="width: 5%;"> <s:checkbox name="storekeeper" fieldValue="true" theme="simple" value="false"/> </td>
                                                
                                            </tr>
                                            <tr>
                                                <td >Director</td>
                                                <%for (int i = 0; i < 12; i++) {%>
                                                <td style="width: 5%;"> <img src="<%= request.getContextPath()%>/css/dot2.png" alt="role" width="20" height="auto" title="role"/>
                                                </td>
                                                    <% }%>
                                                <td style="width: 5%;"> <s:checkbox name="director" theme="simple" fieldValue="true" value="false"/> </td>
                                            </tr>
                                        </tbody>
                                    </table> 
                                </div>
                                           
                            </div>
                            <div class="registerFormVertical">
                                <table style="float: right;">
                                        <tr>
                                            <td>
                                                <s:reset value="Reset" cssStyle="width: 96px" theme="simple" />
                                            </td>
                                            <td>
                                                <s:submit value="Add Staff" cssStyle="width: 96px; margin-left: 132px" theme="simple" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2"><s:actionerror /></td>
                                        </tr>
                                    </table>
                            </div>
                        </div>
                    </div>
                    </s:form>
                </div>
        <footer>
            <div id="footer">
                <%@include file="/include/iFooter.jsp" %>
            </div>   
        </footer>

    </body>
</html>
<%
    }
%>